import request from '@/utils/request'

/**
 * 分页查询供应商
 * @param {*} form
 * @param {*} pageSize
 * @param {*} currentPage
 */
export function dataList(form, pageSize, currentPage) {
  const data = {
    param: form,
    pageSize: pageSize,
    pageNo: currentPage
  }
  return request.post('/supplier/page', data)
}

/**
 * 根据id修改供应商状态
 * @param {*} options
 */
export function changeStatus(id) {
  return request.get(`/supplier/status/${id}`)
}

/**
 * 新增供应商
 * @param {*} options
 */
export function addData(options) {
  return request.post('/supplier/save', options)
}

/**
 * 编辑供应商
 * @param {*} options
 */
export function updateData(options) {
  return request.put('/supplier/save', options)
}
/**
 * 删除供应商
 * @param {*} id
 */
export function deleteData(id) {
  return request.delete(`/supplier/${id}`)
}
/**
 * 根据id查询供应商详情
 * @param {*} options
 */
export function details(id) {
  return request.get('/supplier/' + id)
}

export function dicts() {
  return request.get('/platform/supplier/dicts')
}

export function getSupplierByStorId(storeId, partsDictId) {
  return request.get(`/supplier/getSupplier/${storeId}/${partsDictId}`)
}

// 根据精品级别获取精品类别
export function getGoodTypeTree(storeId) {
  return request.post(`/sq/jpManagement/brandLargeCla/tree`, storeId)
}
